// run: $exec < input
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>

using pair = std::pair<long long, long long>;
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n && n) {
		std::list<pair> l;
		for (int i = 0; i < n; i++) {
			long long op, x, y;
			std::cin >> op >> x >> y;
			if (op == 1) {
				l.push_back({x, y});
			} else if (op == -1) {
				pair tmp(x, y);
				for (auto it = l.begin(); it != l.end(); ++it)
					if (*it == tmp) {
						l.erase(it);
						break;
					}
			} else {
				auto tmp = *l.begin();
				long long ans = tmp.first * x + tmp.second * y;
				for (auto i : l)
					ans = std::max(ans, x * i.first + y * i.second);
				std::cout << ans << "\n";
			}
		}
	}
}

